/*
 * @Author: fisher
 * @Date: 2024-02-26 11:13:12
 * @LastEditors: fisher luthor-li@qq.com
 * @LastEditTime: 2024-03-27 11:43:13
 * @FilePath: \pscluster\controllers\ueinstanceController.js
 * @Description:
 */
// controllers/ueInstanceController.js
const ueInstanceService = require('../services/ueinstanceService')
const startUeinstance = async ctx => {
  const { data } = ctx.request.body
  try {
    await ueInstanceService.startUeinstance(data)
    ctx.status = 200
    ctx.body = {
      status: true,
      message: `集群节点:${process.env.HOST} 启动ue工程成功!`
    }
  } catch (err) {
    throw new HttpError(err.message, 400)
  }
}

const stopUeinstance = async ctx => {
  const { ids } = ctx.request.body
  try {
    await ueInstanceService.stopUeinstance(ids)
    ctx.status = 200
    ctx.body = {
      status: true,
      message: `集群节点:${process.env.HOST} 停止ue工程成功!`
    }
  } catch (err) {
    throw new HttpError(err.message, 400)
  }
}

const deleteUeinstance = async ctx => {
  const { ids } = ctx.request.body
  try {
    await ueInstanceService.deleteUeinstance(ids)
    ctx.status = 200
    ctx.body = {
      status: true,
      message: `集群节点:${process.env.HOST} 删除ue工程成功!`
    }
  } catch (err) {
    throw new HttpError(err.message, 400)
  }
}
module.exports = {
  startUeinstance,
  stopUeinstance,
  deleteUeinstance
}
